package com.koron.standard.jobStock.maintain.service;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.koron.standard.jobStock.maintain.bean.po.MaintainItemParams;
import com.koron.standard.jobStock.maintain.mapper.MaintainItemParamsMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 日常维护标准下作业参数(MaintainItemParams)表服务实现类
 *
 * @author jzp
 * @since 2021-09-07
 */
@Service
public class MaintainItemParamsService extends ServiceImpl<MaintainItemParamsMapper, MaintainItemParams> {

    public void removeByMaintainId(String maintainId) {
        if (StrUtil.isEmpty(maintainId)) {
            return;
        }
        LambdaQueryWrapper<MaintainItemParams> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(MaintainItemParams::getMaintainId, maintainId);
        List<MaintainItemParams> list = list(wrapper);
        removeByIds(list.stream().map(MaintainItemParams::getId).collect(Collectors.toList()));
    }
}
